import config.Config;
import core.Handler;
import log.Logger;
import request.Request;
import response.Response;
import response.StaticResponse;

import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class MultiServer {
    public static void main(String[] args) throws IOException {
        Config config = Config.getConfig();

        ServerSocket serverSocket = new ServerSocket(config.getPort());
        ExecutorService es = Executors.newFixedThreadPool(config.getMaxThread());

        Logger.openFile();

        while (true) {
            Socket socket = serverSocket.accept();
//            System.out.println("accepted");

            es.execute(new Handler(socket));
        }
    }
}
